class Tag < ActiveRecord::Base
  has_many :tag_count
  has_many :picture, :through => :tag_count


  def self.is_tag_in_bag(single_tag,bag)
    bag.each do |tag|
      if tag == single_tag
        return true
      end
    end
    return false
  end

  def add_to_picture(picture_id)
    picture = Picture.find(picture_id)
    picture.add_tag(self)
    picture.save
  end

end
